<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<%
		String path = request.getContextPath();
		String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
	%>
	<base href="<%=basePath%>">
    <meta charset="UTF-8">
    <title>找回密码</title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <script type="text/javascript" src="jquery1.8/jquery-1.8.0.min.js"></script>
    <meta name="Keywords" content="网站关键词">
    <meta name="Description" content="网站介绍">
    <link rel="stylesheet" href="./css/base.css">
    <link rel="stylesheet" href="./css/iconfont.css">
    <link rel="stylesheet" href="./css/reg.css">
    <style>
    	#logo{
    		width: 147px; height: 100px;
    		z-index:999;
			position:fixed; left:0px; top:0px;
    	}
    </style>
</head>
<body>
	<div id="logo">
		<a href="homePage.jsp"><img src="images/bj2.png" /> </a>
	</div>
<div id="ajax-hook"></div>
<div class="wrap">
    <div class="wpn">
        <div class="form-data find_password" style="height: 300px;">
            <h4>找回密码</h4>
            <form action="" method="post">
            	<p class="right_now">已有账号，<a href="./index.jsp">马上登录</a></p>
            	<p style="text-align:center;"><span id="t1" style="text-align:center;">&nbsp;</span></p>
	            <p class="p-input pos">
	                <label for="pc_tel">请输入手机号</label>
	                <input  type="text" id="pc_tel">
	                <span id="pd" style="display: none;" class="tel-warn pc_tel-err "><em>此手机号没有绑定用户！</em><i class="icon-warn"></i></span>
	            </p>
	            <p class="p-input pos">
	                <label for="veri-code">输入验证码</label>
	                <input type="number" id="veri-code">
	                <a href="javascript:void(0);" onclick="note()" class="send">发送验证码</a>
	                <span class="time hide"><em>120</em>s</span>
	                <span id="yzm" style="display: none;margin-right: 60px;margin-top: 2px;" class="tel-warn"><em>验证码错误，请重新输入</em><i class="icon-warn"></i></span>
	            </p>
	            <p class="p-input pos code pc-code">
	                <label for="veri">请输入验证码</label>
	                <input type="text" id="veri">
	                <img src="">
	                <span class="tel-warn img-err hide"><em>最多五个字</em><i class="icon-warn"></i></span>
	                <!-- <a href="javascript:;">换一换</a> -->
	            </p>
	            <input type="button" value="下一步"  onclick="resetpwd()" class="lang-btn next" style="margin-top: 260px;margin-left: 61px;"/>
	            <p class="right">Powered by © 2018</p>
            </form>
        </div>
    </div>
</div>
</body>
<script src="./js/jquery2.js"></script>
<script src="./js/agree.js"></script>
<script type="text/javascript">
	function note(){
		var reg = new RegExp("^1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$"); 
		var isS = reg.test($("#pc_tel").val());
		if(isS){
			$("#t1").html("     ");
			$("#t1").css("color","white");
			$.ajax({
					data:{"phone":$("#pc_tel").val()},
					type:"post",
					url:"<%=basePath%>note.do",
					dataType:"json",
					cache:false,//缓存
					success:function(data){
						if(data.result==true){
							$("#pd").css("display","none");
							alert("信息已发送!");
						}else{
							$("#pd").css("display","block");
						}
					},
					error:function(){
						alert("失败!");
					}
			});
		}else {
			$("#t1").html("号码格式不正确！");
			$("#t1").css("color","red");
		}
	}
		

	function resetpwd() {
		$.ajax({
			data:{"phone":$("#pc_tel").val(),"code":$("#veri-code").val()},
			type:"post",
			url:"<%=basePath%>forget.do",
			dataType:"json",
			success:function(date){
				if(date.result==true){
					$("#yzm").css("display","none");
					location.href="<%=basePath%>resetpwd.jsp";
				}else{
					$("#yzm").css("display","block");
				}
			},
			error:function(){
				alert("失败!");
			}
		});
	}
</script>
</html>